package what.basic.runnable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

import what.basic.basiccomponent.*;
class process1 extends Thread{
	public process1(){
		JFrame f=new Jframe().jframe("swing multiple thread test", 00, 400, true);
		JPanel jp=new JPanel();
		f.setContentPane(jp);
		JButton b1=new JButton("open  window 1");
		JButton b2=new JButton("open  window 2");
		JButton b3=new JButton("open  window 3");
		JButton b4=new JButton("open  window 4");
		JButton b5=new JButton("open  window ");
		JButton b6=new JButton("open  window ");
		jp.setLayout(new GridLayout(2,3));
		jp.add(b1);
		jp.add(b2);
		jp.add(b3);
		jp.add(b4);
		jp.add(b5);
		jp.add(b6);
		b1.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				SwingWorker work=new SwingWorker(){

					@Override
					protected Object doInBackground() throws Exception {
						try{
							sleep(10000);
						}
						catch(Exception e){}
						frame1 f=new frame1();
						return null;
					}
					
				};work.execute();
			}
			
		});
		b2.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				SwingWorker work=new SwingWorker(){

					@Override
					protected Object doInBackground() throws Exception {
						try{
							sleep(10000);
						}
						catch(Exception e){}
						frame2 f=new frame2();
						return null;
					}
					
				};work.execute();
			}
			
		});
		b3.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				SwingWorker work=new SwingWorker(){

					@Override
					protected Object doInBackground() throws Exception {
						try{
							sleep(10000);
						}
						catch(Exception e){}
						frame3 f=new frame3();
						return null;
					}
					
				};work.execute();
			}
			
		});
		b4.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				SwingWorker work=new SwingWorker(){

					@Override
					protected Object doInBackground() throws Exception {
						try{
							sleep(10000);
						}
						catch(Exception e){}
						frame4 f=new frame4();
						return null;
					}
					
				};work.execute();
			}
			
		});
		b5.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				SwingWorker work=new SwingWorker(){

					@Override
					protected Object doInBackground() throws Exception {
						try{
							sleep(10000);
						}
						catch(Exception e){}
						frame5 f5=new frame5();
						return null;
					}
					
				};work.execute();
			}
			
		});
		b6.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				SwingWorker work=new SwingWorker(){

					@Override
					protected Object doInBackground() throws Exception {
						try{
							//sleep(10000);
						}
						catch(Exception e){}
						frame6 f6=new frame6();
						return null;
					}
					
				};
				work.execute();
			}
			
		});
		f.setResizable(false);
	}
	class frame1{
		frame1(){
			JFrame f=new Jframe().jframe("swingworker 1 ", 200, 300, true);
			JPanel jp=new JPanel();
			f.setContentPane(jp);
			JButton b1=new JButton("this is window 1");
			jp.add(b1);
		}
		}
	class frame2{
		frame2(){
			JFrame f=new Jframe().jframe("swingworker 2 ", 200, 300, true);
			JPanel jp=new JPanel();
			f.setContentPane(jp);
			JButton b1=new JButton("this is window 2");
			jp.add(b1);
		}
		}
	class frame3{
		frame3(){
			JFrame f=new Jframe().jframe("swingworker 3 ", 200, 300, true);
			JPanel jp=new JPanel();
			f.setContentPane(jp);
			JButton b1=new JButton("this is window 3");
			jp.add(b1);
		}
		}
	class frame4{
		frame4(){
			JFrame f=new Jframe().jframe("swingworker 4 ", 200, 300, true);
			JPanel jp=new JPanel();
			f.setContentPane(jp);
			JButton b1=new JButton("this is window 4");
			jp.add(b1);
		}
		}
	class frame5{
		frame5(){
			JFrame f=new Jframe().jframe("swingworker  ", 200, 300, true);
			JPanel jp=new JPanel();
			f.setContentPane(jp);
			JButton b1=new JButton("this is window ");
			jp.add(b1);
		}
		}
	class frame6{
		frame6(){
			JFrame f=new Jframe().jframe("swingworker  ", 200, 300, true);
			JPanel jp=new JPanel();
			f.setContentPane(jp);
			JButton b1=new JButton("this is window ");
			jp.add(b1);
		}
		}
	}
public class Jswingworker {
	public static void main(String[] args) {
		try{
			//SwingUtilities.invokeLater(new Runnable(){
			SwingUtilities.invokeAndWait(new Runnable(){
			public void run(){
					new process1();
				}
			});
			}
			
		catch(Exception e){}
}
}
